package cn.gengar.domain.trade.model.valobj;

import lombok.*;

import java.util.Arrays;
import java.util.Objects;

/**
 * @description 交易订单状态枚举
 * @create 2025-01-11 10:21
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum TradeOrderStatusEnumVO {

    CREATE(0, "初始创建"),
    COMPLETE(1, "消费完成"),
    CLOSE(2, "超时关单"),
    ;

    private Integer code;
    private String info;

    public static TradeOrderStatusEnumVO valueOf(Integer code) {
        return Arrays.stream(TradeOrderStatusEnumVO.values())
                .filter(value -> Objects.equals(value.code, code))
                .findFirst()
                .orElse(CREATE);
    }

}
